package com.lyj.sc.tianchi;

import java.util.HashSet;
import java.util.Set;

/**
 * @program: code-random
 * @description:
 * @author: lyj
 * @create: 2022-07-13 14:29
 * @version: 1.0
 * @Modifier By:
 **/
public class test1 {
    public int removeDuplicates(int[] nums) {
        //字符串 双指针法
        int n = nums.length;
        if(n==0){
            return 0;
        }
        int slow=1;
        int fast=1;
        while (fast<nums.length){
            if(nums[slow]==nums[fast]){
                fast++;
                continue;
            }else {
                nums[slow]=nums[fast];
                slow++;
            }
        }
        return slow;
    }
}
